//
//  SYTuDiHeaderView.m
//  SanYiTeaching
//
//  Created by 郑浩然 on 2019/4/24.
//  Copyright © 2019年 SanYi. All rights reserved.
//

#import "SYTuDiHeaderView.h"
#import "SYFuntionHeaderView.h"

@interface SYTuDiHeaderView ()

@property (strong, nonatomic) UILabel *headerLab;//小组名称
@property (strong, nonatomic) SYFuntionHeaderView *headerViewKS;//开始
@property (strong, nonatomic) SYFuntionHeaderView *headerViewJS;//结束
@property (strong, nonatomic) SYFuntionHeaderView *headerViewCY;//成员数量
@property (strong, nonatomic) SYFuntionHeaderView *headerViewXZ;//小组简介
@property (strong, nonatomic) SYFuntionHeaderView *headerViewZT;//当前状态


@end



@implementation SYTuDiHeaderView

- (instancetype)init {
    self = [super init];
    if (self) {
        self.backgroundColor = [UIColor colorWithHexString:@"#F8F8F8"];
        [self initSubView];
    }
    return self;
}

- (void)initSubView {
    [self addSubview:self.headerLab];
    [self.headerLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(self.mas_centerX);
        make.top.equalTo(self.mas_top).offset(18);
    }];
    CGFloat height = 40;
    CGFloat width = 330;
    //开始日期
    [self addSubview:self.headerViewKS];
    [self.headerViewKS mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.headerLab.mas_bottom).offset(10);
        make.left.equalTo(self.mas_left).offset(70);
        make.width.mas_equalTo(width);
        make.height.mas_equalTo(height);
    }];
    //结束日期
    [self addSubview:self.headerViewJS];
    [self.headerViewJS mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.headerViewKS.mas_centerY);
        make.left.equalTo(self.mas_centerX).offset(70);
        make.width.mas_equalTo(width);
        make.height.mas_equalTo(height);
    }];
    //成员数量
    [self addSubview:self.headerViewCY];
    [self.headerViewCY mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.headerViewKS.mas_centerX);
        make.trailing.equalTo(self.headerViewKS.mas_trailing);
        make.top.equalTo(self.headerViewKS.mas_bottom).offset(10);
        make.width.mas_equalTo(width);
        make.height.mas_equalTo(height);
    }];
    //小组简介
    [self addSubview:self.headerViewXZ];
    [self.headerViewXZ mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.headerViewKS.mas_centerX);
        make.trailing.equalTo(self.headerViewKS.mas_trailing);
        make.top.equalTo(self.headerViewCY.mas_bottom).offset(10);
        make.width.mas_equalTo(width);
        make.height.mas_equalTo(height);
    }];
    //当前状态
    [self addSubview:self.headerViewZT];
    [self.headerViewZT mas_makeConstraints:^(MASConstraintMaker *make) {
        make.trailing.equalTo(self.headerViewJS.mas_trailing);
        make.centerY.equalTo(self.headerViewCY.mas_centerY);
        make.width.mas_equalTo(width);
        make.height.mas_equalTo(height);
    }];
    
    //top
    [self addSubview:self.topView];
    [self.topView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.mas_bottom).offset(0);
        make.left.equalTo(self.mas_left).offset(14);
        make.right.equalTo(self.mas_right).offset(-14);
        make.height.mas_equalTo(40);
    }];
    
}

- (UILabel *)headerLab {
    if (!_headerLab) {
        _headerLab = [UILabel titleColour:TITLECOLOR
                               titleFount:14
                                 pingfang:@"PingFang-SC-Medium"
                                alignment:NSTextAlignmentCenter
                                titleLine:1];
        _headerLab.text = @"吴亚茹2019师训小组";
    }
    return _headerLab;
}
//开始日期
- (SYFuntionHeaderView *)headerViewKS {
    if (!_headerViewKS) {
        _headerViewKS = [[SYFuntionHeaderView alloc] init];
        _headerViewKS.titleLab.text = @"开始日期: ";
        _headerViewKS.textField.hidden = YES;
    }
    return _headerViewKS;
}
//结束日期
- (SYFuntionHeaderView *)headerViewJS {
    if (!_headerViewJS) {
        _headerViewJS = [[SYFuntionHeaderView alloc] init];
        _headerViewJS.titleLab.text = @"结束日期: ";
        _headerViewJS.textField.hidden = YES;
    }
    return _headerViewJS;
}
//成员数量 headerViewXZ
- (SYFuntionHeaderView *)headerViewCY {
    if (!_headerViewCY) {
        _headerViewCY = [[SYFuntionHeaderView alloc] init];
        _headerViewCY.titleLab.text = @"成员数量: ";
        _headerViewCY.contLab.text = @"5";
        _headerViewCY.contLab.textColor = [UIColor colorWithHexString:@"#FF4800"];
        _headerViewCY.textField.hidden = YES;
    }
    return _headerViewCY;
}
//小组简介
- (SYFuntionHeaderView *)headerViewXZ {
    if (!_headerViewXZ) {
        _headerViewXZ = [[SYFuntionHeaderView alloc] init];
        _headerViewXZ.titleLab.text = @"小组简介: ";
        _headerViewXZ.contLab.text = @"好好学习，天天向上";
        _headerViewXZ.textField.hidden = YES;
    }
    return _headerViewXZ;
}

- (SYFuntionHeaderView *)headerViewZT {
    if (!_headerViewZT) {
        _headerViewZT = [[SYFuntionHeaderView alloc] init];
        _headerViewZT.titleLab.text = @"当前状态: ";
        _headerViewZT.contLab.text = @"进行中";
        _headerViewZT.contLab.textColor = [UIColor colorWithHexString:@"#FF4800"];
        _headerViewZT.textField.hidden = YES;
    }
    return _headerViewZT;
}

- (SYTopView *)topView {
    if (!_topView) {
        _topView = [[SYTopView alloc] init];
        _topView.titleLab.text = @"听课信息";
        _topView.backgroundColor = [UIColor colorWithHexString:@"#F8F8F8"];

    }
    return _topView;
}


@end
























